from api.biz.base.base_info import BaseClientApi


class StyleProcessImportApi(BaseClientApi):
    def __init__(self, styleId, versionId, productType, file_path, files):
        super().__init__()
        self.headers = {
            "Authorization": BaseClientApi.auth_token,
            # "Accept":"application/json, text/plain, */*"
        }
        # self.headers["Content-Type"] = "multipart/form-data; boundary=----WebKitFormBoundary7A3emAEIhGe11ktv"
        self.url = f"{self.host}/styleProcess/import?styleId={styleId}&versionId={versionId}&productionType={productType}&url={file_path}"
        self.method = "post"
        self.files = files


class StyleProcessQueryApi(BaseClientApi):
    def __init__(self, versionId, styleId):
        super().__init__()
        # self.headers = {
        #     "Authorization": BaseClientApi.auth_token,
        #     "Accept": "application/json, text/plain, */*"
        # }
        self.url = f"{self.host}/styleProcess/page?size=-1&versionId={versionId}&productionType=PRODUCTION_TYPE_SEWING&styleId={styleId}"
        self.method = "get"


class AddOneStyleSewingProcessApi(BaseClientApi):
    def __init__(self, versionId,styleId,processNo):
        super().__init__()
        self.url = f"{self.host}/styleProcess/add"
        self.method = "post"
        self.json = {"versionId": versionId, "styleId": styleId,
                     "productionType": "PRODUCTION_TYPE_SEWING", "processNo": processNo, "useTemplate": False, "imageList": [],
                     "videoList": [], "processName": "测试新增工序", "processType": "PROCESS_TYPE_CF"}


class DeleteOneStyleSewingProcessApi(BaseClientApi):
    def __init__(self, versionId, processId):
        super().__init__()
        self.url = f"{self.host}/styleProcess/delete?versionId={versionId}"
        self.method = "post"
        self.json = [{"id": f"{processId}"}]
